API Documentation
Static Public Member Functions | List of all members
nkAstraeus::lua::nkMathsWrap::VectorWrapper Class Referencefinal

Wraps a nkMaths::Vector and offers functions for use in scripting. More...

Static Public Member Functions

static void updateEnvironment (nkScripts::Environment *env)
 
static void * constructor (const nkScripts::DataStack &stack)
 
static void destructor (void *toDestroy)
 
static nkScripts::OutputValue newVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue newVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue newVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getX (void *vector)
 
static nkScripts::OutputValue getY (void *vector)
 
static nkScripts::OutputValue getZ (void *vector)
 
static nkScripts::OutputValue getW (void *vector)
 
static void setX (const nkScripts::DataStack &stack)
 
static void setY (const nkScripts::DataStack &stack)
 
static void setZ (const nkScripts::DataStack &stack)
 
static void setW (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getDistance (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue toString (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue add (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue sub (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue mul (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue div (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue eq (const nkScripts::DataStack &stack)
 

Detailed Description

Wraps a nkMaths::Vector and offers functions for use in scripting.

Member Function Documentation

◆ updateEnvironment()

static void nkAstraeus::lua::nkMathsWrap::VectorWrapper::updateEnvironment ( nkScripts::Environment env)
static

Updates a given environment and set it up to use all functions wrapped by this wrapper.

Parameters
envThe environment to set up.

◆ constructor()

static void* nkAstraeus::lua::nkMathsWrap::VectorWrapper::constructor ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type.

local t = nkMaths.Vector.new() ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ destructor()

static void nkAstraeus::lua::nkMathsWrap::VectorWrapper::destructor ( void *  toDestroy)
static

Wrapper function for the destructor of the user type.

Parameters
toDestroyThe data that has to be freed.

◆ newVec2()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::newVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type. Will map to the vector 2 constructor.

local t = nkMaths.Vector.newVec2(x, y) ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ newVec3()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::newVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type. Will map to the vector 3 constructor.

local t = nkMaths.Vector.newVec3(x, y, z) ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ newVec4()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::newVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type. Will map to the vector 4 constructor.

local t = nkMaths.Vector.newVec4(x, y, z, w) ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ getX()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::getX ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getX(), exposed as an attribute getter.

local d = v.x ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ getY()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::getY ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getY(), exposed as an attribute getter.

local d = v.y ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ getZ()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::getZ ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getZ(), exposed as an attribute getter.

local d = v.z ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ getW()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::getW ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getW(), exposed as an attribute getter.

local d = v.w ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ setX()

static void nkAstraeus::lua::nkMathsWrap::VectorWrapper::setX ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setX(), exposed as an attribute setter.

v.x = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setY()

static void nkAstraeus::lua::nkMathsWrap::VectorWrapper::setY ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setY(), exposed as an attribute setter.

v.y = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setZ()

static void nkAstraeus::lua::nkMathsWrap::VectorWrapper::setZ ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setZ(), exposed as an attribute setter.

v.z = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setW()

static void nkAstraeus::lua::nkMathsWrap::VectorWrapper::setW ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setW(), exposed as an attribute setter.

v.w = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ getDistance()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::getDistance ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getDistance().

local d = v:getDistance(p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ toString()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::toString ( const nkScripts::DataStack stack)
static

Overrides the default string conversion function.

print(v) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a string.

◆ add()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::add ( const nkScripts::DataStack stack)
static

Overrides the default add operation for the user type.

local v = p + t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ sub()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::sub ( const nkScripts::DataStack stack)
static

Overrides the default subtract operation for the user type.

local v = p - t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ mul()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::mul ( const nkScripts::DataStack stack)
static

Overrides the default multiply operation for the user type.

local v = p * t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ div()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::div ( const nkScripts::DataStack stack)
static

Overrides the default divide operation for the user type.

local v = p / t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ eq()

static nkScripts::OutputValue nkAstraeus::lua::nkMathsWrap::VectorWrapper::eq ( const nkScripts::DataStack stack)
static

Overrides the default equality operation for the user type.

local v = p == t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a bool.

The documentation for this class was generated from the following file: